﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace ConvertToJs
{
    public class Converter
    {
        public List<JsClass> Convert(Assembly assembly)
        {
            var result = new List<JsClass>();

            foreach (var assemblyName in Assembly.GetExecutingAssembly().GetReferencedAssemblies())
            {
                foreach (var type in assembly.GetTypes())
                {
                    var jsClass = new JsClass {Name = type.Name, Content = "function "+type.Name+ " (){"};

                    foreach(var prop in type.GetProperties())
                    {

                            jsClass.Content += prop.Name + "= null;";
                        
                        
                    }

                    jsClass.Content += "}";

                    result.Add(jsClass);
                }
            }

            return result;
        }
    }
}
